// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: '',
      redirect: '/housing/workbench',
    },
    {
      path: '/housing',
      redirect: '/housing/workbench',
      name: 'home',
      component: () => import('@/views/home/Home.vue'),
      children: [
        // 住房管理工作台
        {
          path: 'workbench',
          name: 'housingWorkbench',
          meta: { title: '工作台' },
          component: () => import('@/views/workbench/index.vue'),
        },
        // 入住信息
        {
          path: 'check-in-management',
          name: 'checkInManagement',
          meta: { title: '入住信息' },
          component: () => import('@/views/checkin-info/index.vue'),
        },
        // 房屋管理
        {
          path: 'house-management',
          name: 'houseManagement',
          meta: { title: '房屋管理' },
          component: () => import('@/views/house/Index.vue'),
        },
        // 人员管理
        {
          path: 'personnel-management',
          name: 'personnelManagement',
          meta: { title: '人员管理' },
          component: () => import('@/views/person/index.vue'),
        },
        // 缴费记录
        {
          path: 'payment-record',
          name: 'paymentRecord',
          meta: { title: '缴费记录' },
          component: () => import('@/views/payment/payment.vue'),
        },
        // 缴费审核
        {
          path: 'payment-review',
          name: 'paymentReview',
          meta: { title: '缴费审核' },
          component: () => import('@/views/payment/paymentcheck.vue'),
        },
        // 催缴
        {
          path: 'reminder',
          name: 'paymentReminder',
          meta: { title: '催缴' },
          component: () => import('@/views/payment/reminder.vue'),
        },
        // 合同管理
        {
          path: 'contract-management',
          name: 'contractManagement',
          meta: { title: '合同管理' },
          component: () => import('@/views/contract/Index.vue'),
        },
        // 缴费审核详情（用于从工作台跳转）
        {
          path: 'payment/audit',
          name: 'paymentAudit',
          meta: { title: '缴费审核' },
          component: () => import('@/views/payment/paymentcheck.vue'),
        },
        // 缴费记录（带筛选参数，用于从工作台跳转）
        {
          path: 'payment/records',
          name: 'paymentRecords',
          meta: { title: '缴费记录' },
          component: () => import('@/views/payment/payment.vue'),
        }
      ]
    },
    // 数据可视化大屏
    // {
    //   path: '/housing/data-screen',
    //   name: 'dataScreen',
    //   component: () => import('@/views/data-screen/Index.vue'),
    // },
    // 蓝图原稿
    {
      path: '/test',
      name: 'test',
      component: () => import('@/views/Test.vue'),
    }
  ],
})

export default router
